package com.divemotor.ventarepuestosinternet.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Embeddable;

import com.divemotor.ventarepuestosinternet.util.Constantes;

@Embeddable
public class SupervisorSucursalPK implements Serializable {
	
	private static final long serialVersionUID = 8529513371858552489L;
	
	@Column(name="cod_id_supervisor", nullable = false, length = 10)
	private Integer idSupervisor;
	@Column(name="cod_id_sucursal", nullable = false, length = 10)
	private Integer idSucursal;
	
	public Integer getIdSupervisor() {
		return idSupervisor;
	}
	
	public void setIdSupervisor(Integer idSupervisor) {
		this.idSupervisor = idSupervisor;
	}
	
	public Integer getIdSucursal() {
		return idSucursal;
	}
	
	public void setIdSucursal(Integer idSucursal) {
		this.idSucursal = idSucursal;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((idSucursal == null) ? 0 : idSucursal.hashCode());
		result = prime * result + ((idSupervisor == null) ? 0 : idSupervisor.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj){
			return true;
		}
		if (obj == null){
			return false;
		}
		if (getClass() != obj.getClass()){
			return false;
		}
		SupervisorSucursalPK other = (SupervisorSucursalPK) obj;
		if (idSucursal == null) {
			if (other.idSucursal != null){
				return false;
			}
		} else if (!idSucursal.equals(other.idSucursal)){
			return false;
		}
		if (idSupervisor == null) {
			if (other.idSupervisor != null){
				return false;
			}
		} else if (!idSupervisor.equals(other.idSupervisor)){
			return false;
		}
		return true;
	}

	@Override
	public String toString() {
		return idSucursal + Constantes.EMPTY;
	}
	
}
